package 力扣日常刷题.木22一月.第09天0117;

/**
 * @author 帅小伙
 * @date 2022/1/17
 * @description
 */
public class Demo08动态规划中等反转字符 {

    public int minFlipsMonoIncr(String s) {
        int dp = 0,one = 0;
        for (char c : s.toCharArray()) {
            if(c == '0'){
                // 1变成0   和当前0变成1
                dp = Math.min(one,dp+1);
            }else{
                one ++;
            }
        }
        return dp;
    }
}
